package com.yoga.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yoga.entity.YogaCoachprivate;
import com.yoga.entity.YogaPrivaterequest;
import com.yoga.service.CoachprivateService;
import com.yoga.utils.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CoachprivateController {
    @Autowired
    private CoachprivateService coachprivateService;
    //查询课程表
    @RequestMapping("coachprivateList")
    public ResultVO coachprivateList() {
        List<YogaCoachprivate> list = coachprivateService.getAll();
        return ResultVO.success("查询成功", list);
    }
    //教练课程信息
    @RequestMapping("coachByPrivate")
    public ResultVO coachByPrivate(Integer coachuid, Integer PageSize, Integer PageNum) {
        PageHelper.startPage(PageNum, PageSize);
        List<YogaPrivaterequest> yogaPrivaterequests = coachprivateService.coachByPrivate(coachuid);
        PageInfo<YogaPrivaterequest> pageInfo = new PageInfo<>(yogaPrivaterequests);
        System.out.println("===========================");

        System.out.println(pageInfo);
        System.out.println("===========================");
        return ResultVO.success("查询成功", pageInfo);
    }

    @RequestMapping("userByPrivate")
    public ResultVO userByPrivate(String uid, Integer PageSize, Integer PageNum) {
        PageHelper.startPage(PageNum, PageSize);
        List<YogaPrivaterequest> list = coachprivateService.userByPrivate(uid);
        PageInfo<YogaPrivaterequest> pageInfo = new PageInfo<>(list);

        return ResultVO.success("查询成功", pageInfo);
    }

    @RequestMapping("getByPrivatetime")
    public ResultVO getByPrivatetime(Integer uid,Integer Month,Integer Day) {
        List<String> list = coachprivateService.getByPrivatetime(uid,Month,Day);
        System.out.println(list+"+++++++++++++++++++++++++++++++++++++++++++++");
        return ResultVO.success("查询成功", list);
    }
}
